/*
 * Read and render Minecraft alpha levels.
 *
 * Written by ZomBuster, adapted by T.Pierron.
 */

#ifndef	ALPHA_LEVEL_H
#define ALPHA_LEVEL_H

#include "UtilityLib.h"

typedef struct Chunk_t *     Chunk;
typedef struct Level_t *     Level;
typedef uint16_t *           DATA16;

struct Chunk_t
{
	ListNode node;
	long     x, y;
	long     offset;
	TEXT     file[1];
};

struct Level_t
{
	int    mapx, mapy, mapz;
	int    posx, posy;
	ULONG  count[128];
	ULONG  mobs[16];
	DATA8  skylight;
	DATA8  blocklight;
	DATA8  data;
	DATA16 minH, curH;
	ULONG  blockC[256];
	ULONG  woolC[16];
	ULONG  woodC[3];
	ULONG  texture[256][257];
};

enum /* Mob ID */
{
	PIG,COW,SHEEP,SQUID,ZOMBIE,SKELETON,CREEPER,SLIME
};

Level LEVEL_New(void);
Level LEVEL_Init(void);
void  LEVEL_GetTexture(Level);
void  LEVEL_Render(APTR to);
int   LEVEL_IDToTerrain(int blockid);

#endif
